{% extends 'base.html' %}
{% block content %}
<h2>消息中心</h2>

<ul class="list-group">
    {% for notice in notifications %}
        <li class="list-group-item {% if not notice.is_read %}list-group-item-info{% endif %}">
            <strong>{{ notice.message }}</strong><br>
            来自: {{ notice.sender.username }} / {{ notice.create_time.strftime('%Y-%m-%d %H:%M') }}
            {% if not notice.is_read %}
                <a href="{{ url_for('notification.mark_read', notification_id=notice.id) }}" class="btn btn-sm btn-primary ms-3">标记已读</a>
            {% endif %}
        </li>
    {% else %}
        <li class="list-group-item">暂无通知</li>
    {% endfor %}
</ul>

{% endblock %}